package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.PermissionBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 权限mapper
 */
@Mapper
public interface IPermissionMapper extends BaseMapper<PermissionBean> {
    /**
     * 通过角色id数组查询角色权限,同时去除重复的权限
     * @param roleIdArray 角色ID数组
     * @return 权限集合
     */
    List<PermissionBean> findByRoleIdArray(Integer[] roleIdArray);

    /**
     * 批量添加角色和权限的外键
     * @param roleId 角色id
     * @param permissionId 权限id数组
     */
    void add(@Param("roleId") Integer roleId, @Param("permissionId") Integer[] permissionId);
}
